<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        const  arr=[
            {
             name: "边伯贤",
             age:21
             },
             {
             name: "吴世勋",
             age:18
             },
             {
             name: "朴灿烈",
             age:22
             },
             {
             name: "张艺兴",
             age:25
             },
             {
             name: "鹿晗",
             age:28
             },
        ]
        
        // 手动封装forEach 代码
arr.forEach((item, key, arr) => {
  console.log(item, key, arr)
})
// console.log(Array.prototype)

function forEachs(arr, ps) {
//   ps(arr[0], 0, arr)
//   ps(arr[1], 1, arr)
//   ps(arr[2], 2, arr)
//   ps(arr[3], 3, arr)
  for (let i = 0; i < arr.length; i++) {
    const item = arr[i]
    ps(arr[i], i, arr)
  }
}
forEachs(arr, function (item, key, arr) {
  // console.log(item, key, array)
  item.say = `我是EXO的${item.name}`
})
console.log(arr)

    </script>
</body>
</html>